Application level handler support#116
Open
mephillips-durham wants to merge 5 commits intoc-jo:mainfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Branched from #114 but could be applied separately.
I may just be doing things wrong, but as the system is currently designed, if you want message handlers or wimp handlers to be called without being identified with a toolbox object, you have to include them in the main class of your application. That's because the dispatcher uses the id_block from Wimp_Poll to identify which toolbox object (or parent or ancestor) is referred to, and calls those handlers, falling back on handlers registered on the application itself. If you want a null poll handler, or a message handler, or any other handler that is not associated with the identifier of a toolbox object, these have to be declared in the application.
This change allows such handlers to be declared in other classes, yet be called at the application level alongside other application handlers. The code does this for any handler declared in a class which inherits neither from Application nor from Object. I am not sure if this is sufficient: it may be that mixins would pose difficulties. But it makes it easier to arrange the code of a bigger application in a logical way.